/**
 * * * * * * * * * * * * * * *
 * author: 马丰彦
 * date: 2021-06-22
 * function: 封装js-cookie
 * * * * * * * * * * * * * * *
 */
import Cookies from "js-cookie";

const Token = "token";
const Role = "role";
const UserName = "name";
const Mobile = "mobile";

export function getToken() {
  return Cookies.get(Token);
}

export function setToken(token) {
  Cookies.set(Token, token);
}

export function removeToken() {
  Cookies.remove(Token);
}

export function getUserName() {
  return Cookies.get(UserName);
}

export function setUserName(username) {
  Cookies.set(UserName, username);
}

export function removeUserName() {
  Cookies.remove(UserName);
}

export function getRole() {
  return JSON.parse(Cookies.get(Role));
}

export function setRole(roles) {
  Cookies.set(Role, JSON.stringify(roles));
}

export function removeRole() {
  Cookies.remove(Role);
}


export function getMobile() {
  return Cookies.get(Mobile);
}

export function setMobile(mobile) {
  Cookies.set(Mobile, mobile);
}

export function removeMobile() {
  Cookies.remove(Mobile);
}